package com.pgybook.db.entity.mapper;

import org.springframework.stereotype.Repository;
import com.pgybook.db.entity.domain.BookCoinDailyAnalysis;
import com.pgybook.db.entity.domain.BookCoinDailyAnalysisEx;
import com.pgybook.db.entity.domain.BookCoinDailyAnalysisKey;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Repository
public interface BookCoinDailyAnalysisMapper {
    int countByExample(BookCoinDailyAnalysisEx example);

    int deleteByExample(BookCoinDailyAnalysisEx example);

    @Delete({
            "delete from bookcoindailyanalysis",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}",
            "and TYPE = #{type,jdbcType=INTEGER}",
            "and SUBTYPE = #{subtype,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(BookCoinDailyAnalysisKey key);

    @Insert({
            "insert into bookcoindailyanalysis (LIBID, BZDAY, ",
            "TYPE, SUBTYPE, TRANSNUM, ",
            "TOTAL)",
            "values (#{libid,jdbcType=INTEGER}, #{bzday,jdbcType=DATE}, ",
            "#{type,jdbcType=INTEGER}, #{subtype,jdbcType=INTEGER}, #{transnum,jdbcType=INTEGER}, ",
            "#{total,jdbcType=DECIMAL})"
    })
    int insert(BookCoinDailyAnalysis record);

    int insertSelective(BookCoinDailyAnalysis record);

    List<BookCoinDailyAnalysis> selectByExample(BookCoinDailyAnalysisEx example);

    @Select({
            "select",
            "LIBID, BZDAY, TYPE, SUBTYPE, TRANSNUM, TOTAL",
            "from bookcoindailyanalysis",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}",
            "and TYPE = #{type,jdbcType=INTEGER}",
            "and SUBTYPE = #{subtype,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    BookCoinDailyAnalysis selectByPrimaryKey(BookCoinDailyAnalysisKey key);

    int updateByExampleSelective(@Param("record") BookCoinDailyAnalysis record, @Param("example") BookCoinDailyAnalysisEx example);

    int updateByExample(@Param("record") BookCoinDailyAnalysis record, @Param("example") BookCoinDailyAnalysisEx example);

    int updateByPrimaryKeySelective(BookCoinDailyAnalysis record);

    @Update({
            "update bookcoindailyanalysis",
            "set TRANSNUM = #{transnum,jdbcType=INTEGER},",
            "TOTAL = #{total,jdbcType=DECIMAL}",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}",
            "and TYPE = #{type,jdbcType=INTEGER}",
            "and SUBTYPE = #{subtype,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(BookCoinDailyAnalysis record);
}
